package org.gorson.function;


import org.apache.flink.streaming.api.functions.ProcessFunction;
import org.apache.flink.util.Collector;
import org.gorson.BO.OdsRepayPlanBO;
import org.gorson.utils.CastUtil;

public class ProcessOdsReplyPlanFunction extends ProcessFunction<String, OdsRepayPlanBO> {
    @Override
    public void processElement(String sentence, Context context, Collector<OdsRepayPlanBO> collector) throws Exception {
        collector.collect(this.map(sentence));
    }

    private OdsRepayPlanBO map(String sentence) {
        String[] strArr = sentence.split("\\t");
        OdsRepayPlanBO repayPlan = new OdsRepayPlanBO();
        repayPlan.setAssetSide(CastUtil.castString(strArr[0].replaceAll("\"", ""), null));
        repayPlan.setCreditNum(CastUtil.castString(strArr[1].replaceAll("\"", ""), null));
        repayPlan.setCurrentTerms(CastUtil.castString(strArr[2].replaceAll("\"", ""), null));
        repayPlan.setPayDate(CastUtil.castString(strArr[3].replaceAll("\"", ""), null));
        repayPlan.setPayPrin(CastUtil.castString(strArr[4].replaceAll("\"", ""), null));
        repayPlan.setPayInte(CastUtil.castString(strArr[5].replaceAll("\"", ""), null));
        repayPlan.setPayPunit(CastUtil.castString(strArr[6].replaceAll("\"", ""), null));
        repayPlan.setRecvPayComInt(CastUtil.castString(strArr[7].replaceAll("\"", ""), null));
        repayPlan.setRecvPayDate(CastUtil.castString(strArr[8].replaceAll("\"", ""), null));
        repayPlan.setRecvPayPrin(CastUtil.castString(strArr[9].replaceAll("\"", ""), null));
        repayPlan.setRecvPayInte(CastUtil.castString(strArr[10].replaceAll("\"", ""), null));
        repayPlan.setRecvPayPunit(CastUtil.castString(strArr[11].replaceAll("\"", ""), null));
        repayPlan.setRecvPayComInt(CastUtil.castString(strArr[12].replaceAll("\"", ""), null));
        repayPlan.setIsclear(CastUtil.castString(strArr[13].replaceAll("\"", ""), null));
        repayPlan.setOvdFlag(CastUtil.castString(strArr[14].replaceAll("\"", ""), null));
        repayPlan.setDataDate(CastUtil.castString(strArr[15].replaceAll("\"", ""), null));
        repayPlan.setStartDate(CastUtil.castString(strArr[16].replaceAll("\"", ""), null));
        return repayPlan;
    }
}
